所以我试图根据用户输入的内容进行计算。像:
if (game1.equalsIgnoreCase ("Bama"));
player = player + 10;
player2 = player2 + 10;
if (game1.equalsIgnoreCase ("OSU"));
player = player + 20;
player2 = player 2 + 20;
无论何时投入使用(OSU或Bama),这都是同时添加两者。我怎么才让它只运行其中一个?
(我是Java的新手,以及这个网站,如果这不是一个干净的问题,请原谅我。
答案 0 :(得分:1)
您的代码存在两个问题:
固定代码应如下:
if (game1.equalsIgnoreCase ("Bama")){
player = player + 10;
player2 = player2 + 10;
}
if (game1.equalsIgnoreCase ("OSU")){
player = player + 20;
player2 = player 2 + 20;
}
答案 1 :(得分:0)
你应该这样做:
from io import BytesIO
import os
from dropbox.client import DropboxClient
client = DropboxClient(ACCESS_TOKEN)
path = 'test.data'
chunk_size = 1024*1024 # 1MB
total_size = os.path.getsize(path)
upload_id = None
offset = 0
with open(path, 'rb') as f:
while offset < total_size:
offset, upload_id = client.upload_chunk(
BytesIO(f.read(chunk_size)),
offset=offset, upload_id=upload_id)
print('Uploaded so far: {} bytes'.format(offset))
# Note the "auto/" on the next line, which is needed because
# this method doesn't attach the root by itself.
client.commit_chunked_upload('auto/test.data', upload_id)
print('Upload complete.')