Twenty years of programming language, which one is your favorite?

Posted by feckless on Mon, 06 Jan 2020 16:44:57 +0100

Introduction: in 2020, the programming language will also determine the best language in 2019. Who will it be? From the perspective of TIOBE, Java, C and Python basically lock the top three positions. The position of Java's boss in the Jianghu can't be shaken.

Original: Zhou radish and radish

In 2020, the programming language will also determine the best language in 2019. Who is it? From the perspective of TIOBE, Java, C and Python basically lock the top three positions. The position of Java's boss in the Jianghu can't be shaken.

Here's a picture of the trend of the TIOBE website, Zhenlou (this is a word for exposing age)!

 

Data acquisition

The data acquisition part is very similar to the previous DB part. It is all about parsing variables in JavaScript code. Just extract the data

def get_pl_data(name):    name_lower = [i.lower() for i in name]    for i in name_lower:        print("Request ", i)        if i == 'c#':            i = 'csharp'        url = 'https://www.tiobe.com/tiobe-index/' + i        res = requests.get(url).text        content = BeautifulSoup(res, "html.parser")        js = content.find_all('script')[9].string        src_text = js2xml.parse(js)        src_tree = js2xml.pretty_print(src_text)        data_tree = BeautifulSoup(src_tree, 'html.parser')        array_list = data_tree.find_all('array')        data_list = []        for array in array_list[3:]:            array_data = array.find_all('number')            data_list.append({'date': array_data[0]['value'] + '-' + array_data[1]['value'] + '-' + array_data[2]['value'],                              'value': array_data[3]['value']})        save_data(i, data_list)

Of course, the list of the top 50 programming languages is obtained in advance, which can be easily obtained through the read ﹣ HTML method of pandas

def get_pl_list():    url = 'https://www.tiobe.com/tiobe-index/'    pl_df = pd.read_html(url)    top_20 = pl_df[0]['Programming Language'].values.tolist()    bottom_30 = pl_df[1]['Programming Language'].values.tolist()    return top_20 + bottom_30

Finally, save it to csv

with open('pl_data.csv', 'a+', encoding='utf-8') as f:            f.write('name,value,date\n')            for d in data:                try:                    row = '{},{},{}'.format(name,                                            d['value'],                                            d['date'])                    f.write(row)                    f.write('\n')                except:                    raise

If there is no accident, in a few minutes, we will be able to get the data of nearly 20 years programming language!

The article has been partially abridged. For the overall language index and graphic content, please click: https://developer.aliyun.com/article/741509?utm_content=g_1000098137

Keywords: JavaScript front-end development Java go PHP C ා C language C++ iOS development Python

Topics: Programming Java Python Javascript