打开一个没有括号的文本文件。该程序读取行并使用大括号显示数据。
Example in my.txt file:
name
address
city state zip
phone
after code to read outputs to a label I get:
{name}
{address}
{city} {state} {zip}
{phone}
I would like it to read:
name
address
city state zip
phone
我尝试了strip() 我试图看看pprint是否有任何东西。 代码如下:
def readprofile():
profin = open("pbreg.txt", "r")
msgstored = profin.readlines()
data_label["text"] = msgstored
profin.close()
after code to read, it outputs to a label with braces:
{name}
{address}
{city} {state} {zip}
{phone}
I would like it to read:
name
address
city state zip
phone