• Save
جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲
Upcoming SlideShare
Loading in...5
×
 

جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲

on

  • 153 views

در این جلسه به بحث ...

در این جلسه به بحث
Namespace
Local and Global variables
پرداختیم
PySec101 Fall 2013 J6E2 By Mohammad Reza Kamalifard
Talk About:
Namespace and Local,Global variables in Python

Statistics

Views

Total Views
153
Views on SlideShare
152
Embed Views
1

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 1

http://www.linkedin.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲ جلسه ششم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۲ Presentation Transcript

    • Python for ethical hackers Mohammad reza Kamalifard kamalifard@datasec.ir
    • Python language essentials Module 1: Introduction to Python and Setting up an Environment for Programing Part 8: Global and Local Variables
    • Global and local Variables in Functions >>> def f(): ... print s >>> s = "I hate spam" >>> f()
    • Global and local Variables in Functions >>> def f(): ... print s >>> s = "I hate spam" >>> f() i hate spam >>>
    • Global and local Variables in Functions >>> def f(): ... s = "Me too." ... print s >>> s = "I hate spam." >>> f() >>> print s Me too. I hate spam.
    • Global and local Variables in Functions >>> ... ... >>> >>> >>> def f(): s = "Me too." print s s = "I hate spam." f() print s
    • Global and local Variables in Functions >>> ... ... ... >>> >>> >>> def f(): print s s = "Me too." print s s = "I hate spam." f() print s
    • Global and local Variables in Functions >>> def f(): ... print s ... s = "Me too." ... print s >>> s = "I hate spam." >>> f() >>> print s UnboundLocalError: local variable 's' referenced before assignment
    • Global and local Variables in Functions >>> def f(): ... global s ... print s ... s = "That's clear." ... print s >>> s = "Python is great!" >>> f() >>> print s
    • Global and local Variables in Functions >>> def f(): ... global s ... print s ... s = "That's clear." ... print s >>> s = "Python is great!" >>> f() >>> print s Python is great! That's clear. That's clear.
    • Global and local Variables in Functions >>> def f(): ... s = "I am globally not known" ... print s >>> f() >>> print s
    • Global and local Variables in Functions >>> def f(): ... s = "I am globally not known" ... print s >>> f() >>> print s I am globally not known Traceback (most recent call last): File "global_local3.py", line 6, in <module> print s NameError: name 's' is not defined
    • References SPSE securitytube training by Vivek Ramachandran SANS Python for Pentesters (SEC573) Violent python Security Power Tools python-course.eu ----------------------------http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/ http://www.python-course.eu/global_vs_local_variables.php
    • This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/ Copyright 2013 Mohammad Reza Kamalifard All rights reserved. Go to Kamalifard.ir/pysec101 to Download Slides and Course martials .