Search Results

Search found 7 results on 1 pages for 'dsaccount1'.

Page 1/1 | 1 

  • Python Permutation Program Flow help

    - by dsaccount1
    Hello world, i found this code at activestate, it takes a string and prints permutations of the string. I understand that its a recursive function but i dont really understand how it works, it'd be great if someone could walk me through the program flow, thanks a bunch! <pre><code> import sys def printList(alist, blist=[]): if not len(alist): print ''.join(blist) for i in range(len(alist)): blist.append(alist.pop(i)) printList(alist, blist) alist.insert(i, blist.pop()) if name == 'main': k='love' if len(sys.argv)1: k = sys.argv[1] printList(list(k))

    Read the article

  • Python3k ctypes printf

    - by dsaccount1
    printf returns 1 instead of Hello World! which is the desired result. I googled it and think its because of the changes in the way sequences are treated. Python-3000 Possible py3k problem resolved. import ctypes msvcrt=ctypes.cdll.msvcrt string=b"Hello World!" msvcrt.printf("%s", string)

    Read the article

  • cant download youtube video

    - by dsaccount1
    I'm having trouble retrieving the youtube video automatically, heres the code. The problem is the last part. download = urllib.request.urlopen(download_url).read() # Youtube video download script # 10n1z3d[at]w[dot]cn import urllib.request import sys print("\n--------------------------") print (" Youtube Video Downloader") print ("--------------------------\n") try: video_url = sys.argv[1] except: video_url = input('[+] Enter video URL: ') print("[+] Connecting...") try: if(video_url.endswith('&feature=related')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=related')[0] elif(video_url.endswith('&feature=dir')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=dir')[0] elif(video_url.endswith('&feature=fvst')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=fvst')[0] elif(video_url.endswith('&feature=channel_page')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=channel_page')[0] else: video_id = video_url.split('www.youtube.com/watch?v=')[1] except: print("[-] Invalid URL.") exit(1) print("[+] Parsing token...") try: url = str(urllib.request.urlopen('http://www.youtube.com/get_video_info?&video_id=' + video_id).read()) token_value = url.split('video_id='+video_id+'&token=')[1].split('&thumbnail_url')[0] download_url = "http://www.youtube.com/get_video?video_id=" + video_id + "&t=" + token_value + "&fmt=18" except: url = str(urllib.request.urlopen('www.youtube.com/watch?v=' + video_id)) exit(1) v_url=str(urllib.request.urlopen('http://'+video_url).read()) video_title = v_url.split('"rv.2.title": "')[1].split('", "rv.4.rating"')[0] if '&quot;' in video_title: video_title = video_title.replace('&quot;','"') elif '&amp;' in video_title: video_title = video_title.replace('&amp;','&') print("[+] Downloading " + '"' + video_title + '"...') try: print(download_url) file = open(video_title + '.mp4', 'wb') download = urllib.request.urlopen(download_url).read() print(download) for line in download: file.write(line) file.close() except: print("[-] Error downloading. Quitting.") exit(1) print("\n[+] Done. The video is saved to the current working directory(cwd).\n")

    Read the article

  • How to replace empty string with zero in comma-separated string?

    - by dsaccount1
    "8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9," I'm doing a programming challenge where i need to parse this sequence into my sudoku script. Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8......... I tried re but without success, help is appreciated, thanks.

    Read the article

  • Information on Hook Constants

    - by dsaccount1
    Anyone can explain what these hooks do? Especially WH_MIN and WH_MAX. http://msdn.microsoft.com/en-us/library/ms644959(VS.85).aspx WH_MIN = -1 WH_MSGFILTER = -1 WH_JOURNALRECORD = 0 WH_JOURNALPLAYBACK = 1 WH_KEYBOARD = 2 WH_GETMESSAGE = 3 WH_CALLWNDPROC = 4 WH_CBT = 5 WH_SYSMSGFILTER = 6 WH_MOUSE = 7 WH_HARDWARE = 8 WH_DEBUG = 9 WH_SHELL = 10 WH_FOREGROUNDIDLE = 11 WH_CALLWNDPROCRET = 12 WH_KEYBOARD_LL = 13 WH_MOUSE_LL = 14 WH_MAX = 15

    Read the article

  • How do I slow down a flash game?

    - by dsaccount1
    Basically the objective is to click on certain targets, which upon doing so would destroy the target and garner you points. I've written a macro to help me until the point where its impossible to even see the target more than a mere flicker, (maybe even less than that, i cant see it with my eyes). But its possible because i believe others have done so. (Maybe on slower comps?) Anyway the question is, how would it be possible to slow down the flash game? I've thought of a couple of ways that could work but i'm not sure how to implement them. 1. Slow down the cpu speed? (smth like that? how?) 2. As the game progress the time the targets appear and stay up is reduced. Maybe theres a variable controlling all of this, isit possible to modify the address of this variable? freeze it or smth? Any ideas, suggestions and especially advice would really be appreciated, thanks!

    Read the article

  • Python3k parse string re help

    - by dsaccount1
    "8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9," I'm doing a programming challenge where i need to parse this sequence into my sudoku script. Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8......... I tried re but without success, help is appreciated, thanks.

    Read the article

1