-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreserved_key_words.py
More file actions
38 lines (34 loc) · 852 Bytes
/
Copy pathreserved_key_words.py
File metadata and controls
38 lines (34 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# List reserved key words (425) in source code using the infomation
# in this project:
# https://github.com/AnanthaRajuCprojects/Reserved-Key-Words-list-of-various-programming-languages
import os
import glob
PATH = "Reserved-Key-Words-list-of-various-programming-languages/"
def to_list():
key_words = []
# /|
# / |
# /__|______
# | __ __ |
# | | || | |
# | |__||__| |
# | __ __()|
# | | || | |
# | | || | |
# | |__||__| |
# |__________|
# stairway to heaven...
os.chdir(PATH)
for file in glob.glob("*.md"):
with open(file) as f:
for line in f:
line = line.lstrip()
if len(line) > 1:
if line[0] == '-':
tokens = line.split()
if len(tokens) > 1:
key_word = line.split()[1]
if len(key_word) != 1: # remove A-Z
key_words += [key_word]
os.chdir("..")
return key_words