Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

append

How do I append to a file?

August 27, 2022 by Tarik

Set the mode in open() to “a” (append) instead of “w” (write): with open(“test.txt”, “a”) as myfile: myfile.write(“appended text”) The documentation lists all the available modes.

Categories python Tags append, file, python Leave a comment

How to append something to an array?

August 23, 2022 by Tarik

Use the Array.prototype.push method to append values to the end of an array: // initialize array var arr = [ “Hi”, “Hello”, “Bonjour” ]; // append new value to the array arr.push(“Hola”); console.log(arr); You can use the push() function to append more than one value to an array in a single call: // initialize array … Read more

Categories javascript Tags append, arrays, javascript Leave a comment

What is the difference between Python’s list methods append and extend?

August 23, 2022 by Tarik

append appends a specified object at the end of the list: >>> x = [1, 2, 3] >>> x.append([4, 5]) >>> print(x) [1, 2, 3, [4, 5]] extend extends the list by appending elements from the specified iterable: >>> x = [1, 2, 3] >>> x.extend([4, 5]) >>> print(x) [1, 2, 3, 4, 5]

Categories python Tags append, data-structures, extend, list, python Leave a comment
Newer posts
← Previous Page1 … Page12 Page13

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa