Skip to content

Commit 5fcacb7

Browse files
committed
Example
1 parent 4a35339 commit 5fcacb7

File tree

1 file changed

+1
-45
lines changed

1 file changed

+1
-45
lines changed

README.md

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -130,51 +130,7 @@ $ __exit__
130130

131131
You can also use PyShell as a module and create your own python script with it:
132132

133-
<pre>
134-
#!/bin/python3
135-
136-
from main import create_file
137-
import os
138-
139-
140-
def create_id_card():
141-
print("Welcome to the ID Card Generator!")
142-
143-
# Get user input
144-
name = input("Enter your name: ")
145-
id_number = input("Enter your ID number: ")
146-
department = input("Enter your department: ")
147-
148-
# Prompt the user to specify the directory
149-
directory = input(
150-
"Enter the directory path to save the ID card (leave blank for the current directory): "
151-
)
152-
153-
if not directory:
154-
# Use the current directory if no directory is specified
155-
directory = ""
156-
157-
# Generate the content for the ID card
158-
id_card_content = f"Name: {name}\nID Number: {id_number}\nDepartment: {department}"
159-
160-
# Create a file name for the ID card
161-
file_name = f"{name.replace(' ', '_')}_ID_Card.txt"
162-
163-
# Create the ID card file in the specified directory
164-
id_card_path = os.path.join(directory, file_name)
165-
create_file(id_card_path)
166-
167-
# Write the ID card content to the file
168-
with open(id_card_path, "w") as id_card_file:
169-
id_card_file.write(id_card_content)
170-
171-
print(f"ID Card created and saved as '{file_name}' in '{directory}'")
172-
173-
174-
if __name__ == "__main__":
175-
create_id_card()
176-
177-
</pre>
133+
![python_code](docs/assets/png/example2.png)
178134

179135
## Contributing
180136

0 commit comments

Comments
 (0)