How to use '__init__ python' in Python

Every line of '__init__ python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
68def __init__(self):
69 self.__ivalue = 5
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

5def __init__(self):
6 if not os.path.exists("config"):
7 fp = open("config", 'w')
8 fp.write("Author:\n")
9 fp.write("Email:\n")
10 fp.close()
11 else:
12 fp = open("config", 'r')
13 while True:
14 line = fp.readline()
15 if len(line) == 0:
16 break
17 if line.startswith('Author'):
18 Python.author = line.split(':')[1]
19 if line.startswith('Email'):
20 Python.email = line.split(':')[1]
21 Python.timeNow = time.strftime('%Y,%m,%d %H:%M:%S')
22 fp.close()

Related snippets