Oppure

Loading
25/07/13 12:55
lorenzoscarrone
premetto ho cominciato a studiare python oggi, ho provato a compilare il mio programma ma mi da il seguente errore:
  File "./android_manager.py", line 7
    def banner:
              ^
SyntaxError: invalid syntax


#!/usr/bin/python

import sys
import os
import subprocess

def banner:
print ###################################
print #                                                                         #
print #     Android-Manager		                                   #
print #		 edited by HackerScarrow                       #
print #					                                   #
print ###################################

def check_device_connection:
 os.system("adb wait-for-device")
 os.system("adb start-server")

def check_options:
 print "1] send file to device  "
 print "2] get file from device "
 print "3] interact with device "
 print "4] reboot device"
 print "5] get serial number of device"
 print "6] quit"

def check_path_file:
 get_file = input("enter path file here:")
 return get_file

def show_sdcard_contents(dir):
 os.system("adb shell ls /sdcard/"+dir)

#####################################################
################### DEVICE PATH #####################

def_dev_path = " /sdcard/"

################### SYSTEM PATH #####################

user = os.system(pwd)
def_sys_path = user

#####################################################

banner
check_device_connection
check_options
choice = input("choose an option: ")

if choice = 1:
	file = check_path_file
	send = "adb push "+file+def_dev_path
	os.system(send)
if choice = 2:
	show_sdcard_contents()
	print "Where I can find your file ?"
	choose_dir = input("choose device directory: ")
	show_sdcard_contents(choose_dir)
	print " Did u find your file ? "
	aws = input("[yes]|[no] : ")
	 if aws = "yes" :
	  choose_file = input("Enter file name : " )
	  pull_file = def_dev_path+choose_file
	  os.system("adb pull "+pull_file+" "+def_sys_path)
if choice = 3:
 	os.system("adb shell ")

if choice = 4:
	os.system("adb reboot")
if choice = 5:
	os.system("adb get-serialno")
if choice = 6:
	os.system("exit")
print ################## See you soon ##########################
Ultima modifica effettuata da lorenzoscarrone 25/07/13 12:58
aaa
25/07/13 13:06
Poggi Marco
Ciao!

Il comando def serve a dichiarare una funzione. Di conseguenza, dopo il nome, vanno inserite le parentesi tonde:
(
...
def banner():
    print"############"
...
)
aaa