by jirawoot » 21/06/2019 10:07 am
หน้าฟังก์ชั่น
Code: Select all
var_string = "mindphp"
def func1(arg):
print('ฟังก์ชั่นที่ 1 =', arg)
return
def func2(arg):
print('ฟังก์ชั่นที่ 2 = ',arg)
return
หน้าเรียกใช้
Code: Select all
import module_myarg
module_myarg.func1('python')
module_myarg.func2('train')
ผลลัพธ์

- Selection_002.png (8.14 KiB) Viewed 502 times
from...import
หน้าฟังก์ชั่น
Code: Select all
var_string = "mindphp"
def func1(arg):
print('ฟังก์ชั่นที่ 1 =', arg)
return
def func2(arg):
print('ฟังก์ชั่นที่ 2 = ',arg)
return
หน้าเรียกใช้
Code: Select all
from module_myarg import func1
func1('hello')
ผลลัพธ์

- Selection_003.png (8.09 KiB) Viewed 502 times
from...import*
หน้าฟังก์ชั่น
Code: Select all
var_string = "mindphp"
def func1(arg):
print('ฟังก์ชั่นที่ 1 =', arg)
return
def func2(arg):
print('ฟังก์ชั่นที่ 2 = ',arg)
return
หน้าเรียกใช้
Code: Select all
from module_myarg import *
func1('hello')
func2('python')
ผลลัพธ์

- Selection_004.png (7.68 KiB) Viewed 502 times
หน้าฟังก์ชั่น
[code]
var_string = "mindphp"
def func1(arg):
print('ฟังก์ชั่นที่ 1 =', arg)
return
def func2(arg):
print('ฟังก์ชั่นที่ 2 = ',arg)
return
[/code]
หน้าเรียกใช้
[code]
import module_myarg
module_myarg.func1('python')
module_myarg.func2('train')
[/code]
ผลลัพธ์
[attachment=2]Selection_002.png[/attachment]
from...import
หน้าฟังก์ชั่น
[code]
var_string = "mindphp"
def func1(arg):
print('ฟังก์ชั่นที่ 1 =', arg)
return
def func2(arg):
print('ฟังก์ชั่นที่ 2 = ',arg)
return
[/code]
หน้าเรียกใช้
[code]
from module_myarg import func1
func1('hello')
[/code]
ผลลัพธ์
[attachment=1]Selection_003.png[/attachment]
from...import*
หน้าฟังก์ชั่น
[code]
var_string = "mindphp"
def func1(arg):
print('ฟังก์ชั่นที่ 1 =', arg)
return
def func2(arg):
print('ฟังก์ชั่นที่ 2 = ',arg)
return
[/code]
หน้าเรียกใช้
[code]
from module_myarg import *
func1('hello')
func2('python')
[/code]
ผลลัพธ์
[attachment=0]Selection_004.png[/attachment]