我需要对数组做一些底层工作。我想利用标准库为我完成工作,因此我不必编写自己的实现并花时间测试它。
#Local script
from os.path import expanduser,isfile
from getpass import getpass
import sys
home = expanduser('~')
from fabric import Connection
if not isfile(f"{home}\AppData\Roaming\comcast_credential"):
user = input('Enter your email adress: ')
password = getpass("Enter your password: ")
with open(f"{home}\AppData\Roaming\comcast_credential", 'w') as cred_file:
cred_file.write(f"{user}\n")
cred_file.write(password)
else:
with open(f"{home}\AppData\Roaming\comcast_credential") as cred_file:
user=cred_file.readline().rstrip('\n')
password=cred_file.readline()
conn = Connection('armkreuz@192.168.1.188')
if user == "" or password == "":
print("No user or password")
exit(0)
print(f"User = {user}")
print(f"Password = {password}")
conn.run(f"/home/armkreuz/scripts/test_password.py {user} {password}")
#Remote script
import sys
from time import sleep
user = sys.argv[1]
password = sys.argv[2]
with open('test.txt', 'w') as file:
file.write(f"User = {user}\n")
file.write(f"Password = {password}")
for x in range(1000):
print(x)
sleep(10)
不足,因为它会进行复印,从而破坏了我拥有的商品的性能。
是否存在满足我要求的课程?还是我必须编写自己的可动态调整大小的数组类?