需要获取不带大括号“ {”的输出

时间:2019-05-04 20:45:31

标签: python-3.x label strip

打开一个没有括号的文本文件。该程序读取行并使用大括号显示数据。

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

0 个答案:

没有答案