掃二維碼與項目經(jīng)理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流
如果想要將已經(jīng)設置好的內容,在轉移到另一個位置要怎么做呢?小編能寫到的方法有,照抄,復制,以及轉移使用。在我們日常辦公上是非常好理解的,就是ctr+v,但是如果想在編程上,將某一位置拿去到別的項目上使用,我們要怎么做呢?想必聰明的小伙伴們都想到了,去調用,那就讓我們來看下怎么去調用本期標題吧!

用python調用python腳本
#!/usr/local/bin/python3.7
import time
import os
count = 0
str = ('python b.py')
result1 = os.system(str)
print(result1)
while True:
count = count + 1
if count == 8:
print('this count is:',count)
break
else:
time.sleep(1)
print('this count is:',count)
print('Good Bye')
另外一個python腳本b.py如下:
#!/usr/local/bin/python3.7
print('hello world')
運行結果:
[python@master2 while]$ python a.py hello world this count is: 1 this count is: 2 this count is: 3 this count is: 4 this count is: 5 this count is: 6 this count is: 7 this count is: 8 Good Bye
直接給大家上代碼演示,是不是非常簡單呢?大部分情況下,大家都可以直接使用上述小編提供的這種模塊流程,但是還是要分別不同情況下的哦~好啦,大家先消化下吧,如果還想了解更多學習教程,點擊python學習網(wǎng)即可哦~

我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流