jeudi 24 octobre 2019

.startswith using multiple variables

I am doing a project for school where I am making a cinema management system but I am a bit rusty with writing to/ reading from text files.

I have a list called lineStarters which contains string values "seatA", "seatB" etc etc.

later on in the project I use the line:

if line.startswith item in lineStarters and if "False" in line:
  line = line.replace("False","True")

This gives a syntax error.

To solve this I already tried a really long conditional statement. This didn't work either.Also it just wouldn't look good for my teacher.

tldr how would i go about using .startswith with multiple variables in Python.

Many thanks.

Aucun commentaire:

Enregistrer un commentaire