I've recently updated to the new version of Qt5 for Python. In doing so, I've been having to alter my code in accordance to some of the notable changes that have occurred. I wanted to get some insight into this line of code that I've created. It feels like a dirty way of solving the problem of getting a string
instead of a tuple
from the function. (Note the [0]
at the end of the line)
filename = QtWidgets.QFileDialog.getOpenFileName(None, "Open " + key + " Data File", '.', "(*.csv)")[0]
I want filename = {str}'C:/.././.../format.csv'
not filename = <class 'tuple'>: ('C:/.././.../format.csv', '(*.csv)')
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…