Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

I heard someone likes lambdas

I read some where one of you guys really liked lambdas and i need your help.
I needed to write a list into a file and i wasnt really sure how to do that, because normal .write doesnt work so i found this-
PHP Code

<?php 
f
.write("\n".join(map(lambda x: str(x), list1))+"\n") 
and i was just wondering what is happening here and i thought someone could explain it to me since i couldnt find a good explanation anywhere.
The best explanation for map function,

PHP Code

<?php 
r 
= map(func, seq)

"""
The first argument func is the name of a function and the second a 
sequence (e.g. a list) seq. map() applies the function func to all 
the elements of the sequence seq. 
It returns a new list with the elements changed by func
""" 


python-course.eu/lambda.php
The point is that each item in the iterable "list1" will be cast as an str type.
SRPP Discord Server

I am a professional network/cloud security architect.
My Old Tutorials


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by vorticalboxSep 17, 2017 09:43 AM 2 90 Sep 17, 2017 09:43 AM
Last Post: vorticalbox
[Java] by g4143Jan 1, 2017 10:50 AM 0 163 Jan 1, 2017 10:50 AM
Last Post: g4143
[Java] by SIM-2015410Sep 5, 2015 05:01 AM 8 451 Sep 5, 2015 05:01 AM
Last Post: +Haze