小编Adr*_*ian的帖子

我需要一个 Python 中的 epub 到文本解决方案

我需要从 epub 获取文本

from epub_conversion.utils import open_book, convert_epub_to_lines

f = open("demofile.txt", "a")
book = open_book("razvansividra.epub")
lines = convert_epub_to_lines(book)
Run Code Online (Sandbox Code Playgroud)

我使用这个,但如果我使用 print(lines) 它只会打印一行。图书馆已经有6年历史了。大家知道有什么好办法吗?

python epub

1
推荐指数
1
解决办法
1万
查看次数

python中的Lstrip函数

我遇到以下代码的问题:

name = "epubtxt\ursita.txt"
Run Code Online (Sandbox Code Playgroud)

我想删除目录,以获得输出 ursita.txt

我正在这样做:

name.lstrip('epubtxt\\')
Run Code Online (Sandbox Code Playgroud)

主要问题是我得到了这个输出:

rsita.txt

这里出了什么问题?

python string

1
推荐指数
1
解决办法
166
查看次数

如果语句未更新同一类中的私有字段

所以我有这个代码从类:

private int velocity = 0;

public void velocityManagement(int speed){
        if (speed > 0){
            System.out.println("Pressing gas pedal");
            velocity += speed;
            System.out.println("Velocity increased to " + velocity + " km/h");
        } else{
            System.out.println("Pressing break");
            velocity -= speed;
            System.out.println("Velocity decreased to " + velocity + " km/h");
        }
Run Code Online (Sandbox Code Playgroud)

这就是我在主类中使用它的方式:

car.velocityManagement(10);
car.velocityManagement(15);
car.velocityManagement(-20);
Run Code Online (Sandbox Code Playgroud)

预期产量:

  • 踩油门踏板
  • 速度提高到10 km / h
  • 踩油门踏板
  • 速度提高到25 km / h
  • 压破
  • 速度降至5 km / h

实际输出:

  • 踩油门踏板
  • 速度提高到10 km / h
  • 踩油门踏板
  • 速度提高到25 km / h
  • 压破
  • 速度降至45 km …

java if-statement

-1
推荐指数
1
解决办法
37
查看次数

标签 统计

python ×2

epub ×1

if-statement ×1

java ×1

string ×1