def generate(count): with open(get_root_directory() + '\\target%s.csv' % count, 'w') as f: f.write("userName,userId\n") for i in range(0, count): f.write( generate_random_string(10) + "," + generate_random_string(10) + "\n")
def get_first_column(file, sep=';'): f2 = open(get_root_directory() + '//file.csv', 'w') with open(file, 'r') as f: reader = csv.reader(f, delimiter=sep) for row in reader: print(row[0]) f2.write(row[0] + ";")
def generate(count): headers = "username,password\n" credentials = [ "employee" + str(i) + "," + "test10" + "\n" for i in range(count) ] f = open(get_root_directory() + '//credentials.csv', 'w') f.write(headers) for x in credentials: f.write(x)
def get_all_files(paths): folders = [] for path in paths: try: only_files = [f for f in listdir(path) if isfile(join(path, f))] folders.extend([ join(path, f) for f in listdir(path) if not isfile(join(path, f)) ]) print(str(only_files)) temp = path.replace(":", "_") temp = temp.replace("\\", "_") found = open(get_root_directory() + "\\files\\" + temp + ".txt", "a") found.write(str(only_files) + "\n") found.flush() except Exception: continue get_all_files(folders)
"dictionaryCode": "Lang", "itemCodes": ["Bulgarian","Catalan","Croatian","Czech","Danish","Dutch","English","Estonian","Finnish","French", "German","Greek","Hungarian","Italian","Hungarian","Italian","Japanese","Latvian","Lithuanian","Norwegian","Polish","Portuguese","Romanian","Russian","Slovak","Slovenian","Spanish"] }, { "dictionaryCode": "Service", "itemCodes": ["Audit_Services","Complaints_Mitigation","Content_Management","Conversion_Services","Customer_Services","Customer_Verification","Incident_Coordination","Campaign_Services","Police_Request_Handling","Product_Testing","Promotion_Services","Risk_Services","VIP_Hosting_Services"] }, { "dictionaryCode": "Shop", "itemCodes":["ACF","binguez.com","BORGATA","bwin.be","bwin.com","bwin.es","bwinfr","empirepoker.com","gamebookers.com","getminted","GiocoDigitale","intralot.it","party.com","party.dk","party.es","party.fr","party.it","party.net","PartyPokerNJ","pmu.fr","Premium"] } ] },}, """ % (i, i, i) def extend_employ(file, range_): file.write("[ ") add_string = "" for i in range(range_[0], range_[1]): add_string = add_string + get_to_append(str(i)) add_string = add_string + " ]" file.write(add_string) if __name__ == '__main__': # file = open("C:/PLIKI/Load_tests/users_with_traits2.txt",'a') file = open(get_root_directory() + "\\users_with_No_traits.json", 'w+') extend_employ(file, (1, 2000))
from Playground.root_directory import get_root_directory sys.setrecursionlimit(10000) def get_all_files(paths): folders = [] for path in paths: try: only_files = [f for f in listdir(path) if isfile(join(path, f))] folders.extend([ join(path, f) for f in listdir(path) if not isfile(join(path, f)) ]) print(str(only_files)) temp = path.replace(":", "_") temp = temp.replace("\\", "_") found = open(get_root_directory() + "\\files\\" + temp + ".txt", "a") found.write(str(only_files) + "\n") found.flush() except Exception: continue get_all_files(folders) if __name__ == "__main__": get_all_files([get_root_directory(), "files"])
L2 = [x + 10 for x in L1] print(L1) print(L2) L3 = [1, 2, 3, 4, 5] for i in range(len(L3)): L3[i] += 10 print(L3) test = "Test" * 10 test2 = [x + "X" for x in test] print(test2) f = open(get_root_directory() + "\\testFile.txt") lines = f.readlines() print(lines) lines = [line.rstrip() for line in lines] print(lines) lines = [ line.rstrip() for line in open(get_root_directory() + "\\testFile.txt") ] print(lines) f2 = open(get_root_directory() + '\\testFile2.txt', 'r+') for _ in range(1, 30): print(''.join( random.choice(string.ascii_uppercase + string.digits)