Python Read Data

博客分类: tools 阅读次数: comments

Python Read Data

Read next line in Python


def searcher():
    print("Please enter the term you would like the definition for")
    find = input()

    with open("glossaryterms.txt", "r") as f:       
        words = list(map(str.strip, f.readlines()))
        try: 
            print(words[words.index(find) + 1])
        except:
            print("Sorry the word is not found.")

add one row in a pandas.DataFrame 【跟着stackoverflow学Pandas】add one row in a pandas.DataFrame -DataFrame添加行 这里 Series 必须是 dict-like 类型

跟着stackoverflow学Pandas专辑

pandas 选择某几列

col_n = [‘名称’,’收盘价’,’日期’]

a = pd.DataFrame(df,columns = col_n)