i've came across this problem that i've been trying to solve: i want to use a txt to randomly pick a car from a txt file but i always get it wrong and i hoped that you could help me here is what i have done so far in this specific part:
import random
if user_input == "1":
with open("cars.txt", "r") as call_uber:
for line in call_uber:
array1 = line.split(" : ")
print(array1)
the objective is to randomly pick the first name of one of the txt file lines but i just managed to split them
ps: i'm a newbie at this.
Aucun commentaire:
Enregistrer un commentaire