我需要从 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年历史了。大家知道有什么好办法吗?
我遇到以下代码的问题:
name = "epubtxt\ursita.txt"
Run Code Online (Sandbox Code Playgroud)
我想删除目录,以获得输出 ursita.txt
我正在这样做:
name.lstrip('epubtxt\\')
Run Code Online (Sandbox Code Playgroud)
主要问题是我得到了这个输出:
rsita.txt
这里出了什么问题?
所以我有这个代码从类:
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)
预期产量:
实际输出: