Συντονιστής: konnn
pmav99 έγραψε:ΕΔΩ η απάντηση
medigeek έγραψε:Βρήκα κάτι που αντί smtp, χρησιμοποιεί sendmail: http://effbot.org/pyfaq/how-do-i-send-m ... script.htm
Δεν το δοκίμασα όμως
Ilias95 έγραψε:Μια ακόμα απορία θέλοντας να δημιουργήσω ένα πακέτο.
Έχω διαβάσει ότι αν δημιουργήσεις έναν φάκελο και μέσα βάλεις ένα αρχείο __init__.py τότε αυτόματα δηλώνεται ότι ο φάκελος περιέχει αρθρώματα python.
Διμηουργώ κάτι σαν το παρακάτω:Spoiler: show
Όμως κάνοντας import το module2 στο module1 παίρνω imporError.
Μου ξεφεύγει κάτι;
Ilias95 έγραψε:
Ακριβώς το ίδιο σφάλμα.
echo "This will go into the body of the mail." | mail -s "Hello world" you@youremailid.com
medigeek έγραψε:Ilias95 έγραψε:
Ακριβώς το ίδιο σφάλμα.
Δοκίμασε στο τερματικό:
- Κώδικας: Επιλογή όλων
echo "This will go into the body of the mail." | mail -s "Hello world" you@youremailid.com
Στείλε το στο δικό σου email και κοίταξε (και στο spam) αν πήρες email.
#! /usr/bin/python3
# Filename: base_converter.py
def convertToBase(toBase, n):
foo = ''
while (n > 0):
x = n%toBase
if (x >= 10):
foo = chr(x + 55) + foo
n = n//toBase
else:
foo = str(x) + foo
n = n//toBase
return foo
num = input('Enter the number you want to convert : ')
base = int(input('Enter the base of the number : '))
new_base = int(input('Now enter the base you want the number to convert to : '))
temp = int(num, base)
print('Decimal number : ', temp)
new_num = convertToBase(new_base, temp)
print('Number in base -', new_base, ' is :', new_num)
#! /usr/bin/python3
# Filename: myprog.py
from tkinter import *
from tkinter import ttk
def clear_all():
number.set('')
base.set('')
new_base.set('')
new_number.set('')
number_entry.focus()
pass
def vanish(*args):
t.destroy()
clear_all()
def convertToBase(toBase, n):
foo = ''
while (n > 0):
x = n%toBase
if (x >= 10):
foo = chr(x + 55) + foo
n = n//toBase
else:
foo = str(x) + foo
n = n//toBase
return foo
def convert(*args):
try:
num = number.get()
b = int(base.get())
new_b = int(new_base.get())
temp = int(num, b)
new_num = convertToBase(new_b, temp)
new_number.set(new_num)
except ValueError:
global t
t = Toplevel(root)
t.title("Oops!")
tcont = ttk.Label(t, text="Please enter all data required and make sure that base is [2, 36]")
tcont.grid(column=0, row=0, pady=25, padx=25)
b = ttk.Button(t, text="OK", command=vanish)
b.grid(column=0, row=1, pady=25, padx=25)
pass
########
root = Tk()
root.title("Base Converter")
mainframe = ttk.Frame(root, padding="12 12 12 12", width=300, height=400)
num_msg = ttk.Label(mainframe, text='Enter the number : ')
base_msg = ttk.Label(mainframe, text='Enter the base of the number : ')
new_base_msg = ttk.Label(mainframe, text='Enter the base to convert to : ')
res_msg = ttk.Label(mainframe, text='Result : ')
#image = PhotoImage(file='Calc.png')
#img = ttk.Label(mainframe, image=image)
number = StringVar()
number_entry = ttk.Entry(mainframe, textvariable=number)
base = StringVar()
base_entry = ttk.Entry(mainframe, textvariable=base)
new_base = StringVar()
new_base_entry = ttk.Entry(mainframe, textvariable=new_base)
conv = ttk.Button(mainframe, text='Convert', command=convert)
conv.pack()
clear = ttk.Button(mainframe, text='Clear All', command=clear_all)
new_number = StringVar()
result = ttk.Label(mainframe, textvariable=new_number)
mainframe.grid(column=0, row=0, sticky=(N, S, E, W))
num_msg.grid(column=0, row=0, pady=5, padx=5)
base_msg.grid(column=0, row=1, pady=5, padx=5)
new_base_msg.grid(column=0, row=2, pady=5, padx=5)
res_msg.grid(column=0, row=3, pady=5, padx=5)
result.grid(column=1, row=3, pady=5, padx=5, sticky=(E, W))
number_entry.grid(column=1, row=0, pady=5, padx=5, sticky=(E, W))
base_entry.grid(column=1, row=1, pady=5, padx=5, sticky=(E, W))
new_base_entry.grid(column=1, row=2, pady=5, padx=5, sticky=(E, W))
clear.grid(column=1, row=4, pady=10, padx=5)
conv.grid(column=2, row=4, pady=10, padx=5)
#img.grid(column=2, row=0, padx= 20, rowspan=3)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
mainframe.columnconfigure(0, weight=3)
mainframe.columnconfigure(1, weight=3)
mainframe.columnconfigure(2, weight=3)
mainframe.rowconfigure(0, weight=1)
mainframe.rowconfigure(1, weight=1)
mainframe.rowconfigure(2, weight=1)
mainframe.rowconfigure(3, weight=1)
mainframe.rowconfigure(4, weight=1)
root.bind('<Return>', convert)
number_entry.focus()
root.mainloop()
assert (toBase > 1), "toBase must be greater than 1!"
if (x >= 10):
foo = chr(x + 55) + foo
else:
foo = str(x) + foo
n = n//toBase
foo = chr(x + 55) + foo if (x >= 10) else str(x) + foo