Python Code - How To Read CSV into an Array of Arrays
Introduction In last post, we saw How to read CSV with Headers into Dictionary…
March 18, 2018
Note: I have public URLs of these images, which I want to save.
return $imageFile; } function save_my_node($valueArray) { $node = new stdClass(); $node->title = $valueArray->title $node->type = ‘my_content_type’; node_object_prepare($node);
$node->language = LANGUAGE_NONE; $node->uid = 1; //see if you want to use another user, or logged in user $node->status = 1; $node->promote = 0; $node->comment = 1; //comments closed $node->sticky = 0;
$node->body[$node->language][0][‘value’] = $valueArray->description; $node->body[$node->language][0][‘format’] = filter_default_format(); $imageObj = _prepareImageObj($valueArray->imageUrl); if (!$imageObj) { return false; } $node->field_image[$node->language][0] = (array)$imageObj;
// Prepare node for saving if ($node = node_submit($node)) { node_save($node);
print "\nNode saved, nid: ".$node->nid . ", videoId: ".$youtube_doc['_id'];
} else { print ‘Error’; } }
You can customize this code for more robust error handling.
Enjoy.
Introduction In last post, we saw How to read CSV with Headers into Dictionary…
Problem Statement I developed a simple ReactJS application where I have used…
Introduction This post is about hosting MongoDB replica set cluster with…
Introduction In a normal email sending code from python, I’m getting following…
While dealing with ELastic Search documents, you faced this issue while updating…
Suppose you have two lists, and you want Union and Intersection of those two…
Introduction This post has the complete code to send email through smtp server…
Introduction In a normal email sending code from python, I’m getting following…
Introduction In one of my app, I was using to talk to . I have used some event…
Introduction So you have a Django project, and want to run it using docker image…
Introduction It is very important to introduce few process so that your code and…
Introduction In this post, we will see a sample Jenkin Pipeline Groovy script…