Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
 |
|

26.01.2009, 20:29
|
|
Banned
Регистрация: 19.06.2006
Сообщений: 1,239
Провел на форуме: 1469161
Репутация:
142
|
|
Пасип  ,буду знать )
|
|
|

27.01.2009, 01:47
|
|
Banned
Регистрация: 19.06.2006
Сообщений: 1,239
Провел на форуме: 1469161
Репутация:
142
|
|
Народ,а как в Python инициализировать запуск процесса какой-то программый,к примеру,paint или user.zip и получить к нему доступ,если возможно)
|
|
|

27.01.2009, 06:15
|
|
Постоянный
Регистрация: 12.06.2008
Сообщений: 654
Провел на форуме: 4512757
Репутация:
973
|
|
http://docs.python.org/library/os.html
Код:
os.startfile(path[, operation])
Start a file with its associated application.
When operation is not specified or 'open', this acts like double-clicking the file in Windows Explorer, or giving the file name as an argument to the start command from the interactive command shell: the file is opened with whatever application (if any) its extension is associated.
When another operation is given, it must be a “command verb” that specifies what should be done with the file. Common verbs documented by Microsoft are 'print' and 'edit' (to be used on files) as well as 'explore' and 'find' (to be used on directories).
startfile() returns as soon as the associated application is launched. There is no option to wait for the application to close, and no way to retrieve the application’s exit status. The path parameter is relative to the current directory. If you want to use an absolute path, make sure the first character is not a slash ('/'); the underlying Win32 ShellExecute function doesn’t work if it is. Use the os.path.normpath() function to ensure that the path is properly encoded for Win32. Availability: Windows.
Код:
import os
os.startfile("C:\Python26\python.exe")
^^^^^
Пример как запустить программу.
А если ты хочешь, чтобы он тебе еще и нарисовал что-нибудь, то лучше юзай для этих целей AutoIt (http://www.autoitscript.com/autoit3/index.shtml)
|
|
|

06.02.2009, 10:05
|
|
Banned
Регистрация: 21.11.2007
Сообщений: 181
Провел на форуме: 1066435
Репутация:
1013
|
|
Код:
a=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9']
for i in range(len(a)):
print a[i]
как сделать что бы буквы складывались? типо:
Код:
aa
ab
ac
ad
...
ba
bb
bc
...
za
zb
потом:
Код:
aaa
aab
...
aba
abb
...
zaa
zab
ну и каждый раз по одной букве
|
|
|

06.02.2009, 10:20
|
|
Познавший АНТИЧАТ
Регистрация: 01.06.2008
Сообщений: 1,047
Провел на форуме: 5321514
Репутация:
3313
|
|
Код:
from __future__ import generators
a = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'1','2','3','4','5','6','7','8','9'
]
def xcombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in xcombinations(items[:i]+items[i+1:],n-1):
yield [items[i]]+cc
def xuniqueCombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in xuniqueCombinations(items[i+1:],n-1):
yield [items[i]]+cc
def xselections(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for ss in xselections(items, n-1):
yield [items[i]]+ss
def xpermutations(items):
return xcombinations(items, len(items))
if __name__=="__main__":
for p in xpermutations(a):
print ''.join(p)
Как-то так
Последний раз редактировалось De-visible; 06.02.2009 в 10:51..
Причина: В этом разделе PHP теги не стоит применять...
|
|
|

06.02.2009, 19:59
|
|
Banned
Регистрация: 21.11.2007
Сообщений: 181
Провел на форуме: 1066435
Репутация:
1013
|
|
как подсчитать кол-во строк, например в txt файле?
|
|
|

07.02.2009, 19:05
|
|
Banned
Регистрация: 06.01.2008
Сообщений: 904
Провел на форуме: 4037638
Репутация:
1821
|
|
Сообщение от faza02
как подсчитать кол-во строк, например в txt файле?
Код:
filehandle = open("myfile", 'r')
print len(filehandle.readlines())
filehandle.close()
Код:
Filehandle =open ("myfile", 'r')
count = 0
while filehandle.readline ()! = " ":
count = count + 1
print count
Filehandle.close ()
|
|
|

23.02.2009, 14:08
|
|
Banned
Регистрация: 21.11.2007
Сообщений: 181
Провел на форуме: 1066435
Репутация:
1013
|
|
реально ли, в питоне создать хэш DES, mysql и др.?
md5 и sha1 ненадо.
|
|
|

23.02.2009, 16:37
|
|
Banned
Регистрация: 06.01.2008
Сообщений: 904
Провел на форуме: 4037638
Репутация:
1821
|
|
Сообщение от faza02
реально ли, в питоне создать хэш DES, mysql и др.?
md5 и sha1 ненадо.
Конечно, и это кстати сделано до нас...
|
|
|

23.02.2009, 16:44
|
|
Banned
Регистрация: 21.11.2007
Сообщений: 181
Провел на форуме: 1066435
Репутация:
1013
|
|
да, но какими модулями? в хэшлиб не нашел.
если можно, пример.
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|