283 questions
3
votes
1
answer
125
views
Where-Object square bracket column name
How to filter a PowerShell object that contains a square bracket column name?
for example:
$data | select-object DisplayName, ``[Custom.Class`].Name
would return:
DisplayName
[Custom.Class].Name
Cat
...
-8
votes
1
answer
114
views
How to flatten extra dimensions in lists down into a single dimension for Python? [duplicate]
Question1. Do you always have to convert a list to string to remove square brackets?
Main Question. I want to remove extra square brackets of a list nested in a list. The [] index of the nested list ...
0
votes
1
answer
43
views
What are the differences between list() and square bracket in Python?
I get to put in some strings, and make it into list, each characters seperated.
some_string = input()
string_list = list(*some_string)
print(string_list)
but list doesn't get this argument if string ...
-2
votes
2
answers
341
views
Meaning of two double brackets ([][]) in Java
What is the role of a pair of double brackets ([][]) in Java?
reference code(Leetcode 1351. Count Negative Numbers in a Sorted Matrix):
class Solution {
public int countNegatives(int[][] grid) {
...
3
votes
3
answers
351
views
sed command returns error about Unmatched (
I need to get rid of the double square brackets, I only need them once. However I get the error below after this command:
sed -ri 's/("opening_hours": \[\[)(.*?)(\]\]/"opening_hours&...
0
votes
1
answer
91
views
Passing var with square bracket into function, like this [1], brackets not recognized PHP 8.2
PHP 8.2: The last 3 hours I am searching for a solution to identify square brackets from a text.
In case I place the string text directly in the function, I can identify the square brackets:
$...
1
vote
2
answers
327
views
React custom hook square bracket curly braces
The point is to use the same custom hook to make different API calls.
The problem:
When I return with {}, it works.
When I return with [], it doesn't:
It does not enter the ApiGetDogFactsComponent ...
-2
votes
3
answers
355
views
How does this overloading of square brackets work [duplicate]
I want to avoid printing space (" ") or an underscore ("_") after the last element of an array while printing them using a for loop. The problem mentions one of the way to do so, I ...
0
votes
2
answers
81
views
what is the purpose of the \ because they do not affect the function of the code? [duplicate]
I have a university assignment to create a noughts&crosses/tictactoe game from a given template and this below was part of it:
board = [['1','2','3'],\
['4','5','6'],\
['7','8','...
0
votes
1
answer
55
views
What is the meaning of [:, 1:] after np.genfromtxt()? [duplicate]
I am struggeling with python now. i'm trying this script.
I am sure this is a very common syntax in python, but it is so generic I can't find any explanation that make sense to me.
Can you help me to ...
0
votes
1
answer
100
views
Json parse in square bracket with same name
I am successfully parsing an api in square brackets with a single name
API output :
{u'energyDetails':
{u'timeUnit': u'DAY',
u'meters':
[{u'values':
...
0
votes
0
answers
16
views
why this deconstructuring return array's length? [duplicate]
I can't find description about this code in JS...
let arr = [3, 1, 5, 1, 2, 1, 1];
let { length } = arr;
console.log(length);
why this code work like arr.length and how should I call it?...
-2
votes
1
answer
239
views
Square brackets problem in GET form method
I'm working on a form in my aaa.php file, with checkboxes using square brackets in the "name" parameter :
<form method="get" action="bbb.php">
<input type=&...
0
votes
1
answer
258
views
what does only right bracket in an equation such as b] = [A]y] means? [closed]
I am writing a paper that uses one of the equations from an old(1969) paper
Now I have been asked the meaning of a single right bracket?
It seems it's differentiating between one dimensional and 2 ...
0
votes
1
answer
42
views
What is functionality of the '[recur]' in 'return (None, [lng])[recur]'
I've solved this challange on CodeWars in the other way, and now I'm learning from other solutions. One of them is:
# Recursive solution
def sqInRect(lng, wdth, recur = 0):
if lng == wdth:
...
1
vote
0
answers
45
views
Powershell command Start-BitsTransfer fails when source file paths contain square brackets [] [duplicate]
EDIT: I'll leave the question here as the help docs don't mention wildcard escaping, but using [WildcardPattern]::Escape('C:\temp\file[file].txt') works.
On Windows (10) it's valid for file paths to ...
0
votes
3
answers
1k
views
How to remove '[' character from a string with re.sub function? [duplicate]
I want to remove the '[' square bracket character from a string.
I am using re library.
I had no problems with this square bracket ']' but I still having problem with this square bracket '['.
My code:
...
0
votes
1
answer
617
views
Getting rid of unnecessary square brackets in a list
I have a list and I'm trying to append a series of new elements to this list in a certain order: Day, IDs (Array), Month, Year. I'm able to add these new elements to the list just fine, however, there ...
1
vote
2
answers
1k
views
TypeScript array square bracket syntax with type values
Is it possible to write "isHoritzontal" using square bracket array syntax AND WITHOUT a variable assignment? I see it's possible with a variable assignment (ie. const a: Placement[] = ["...
0
votes
1
answer
910
views
Iterate Through the Keys of an Object with a for...in Statement
Why is it that bracket notation allows the code to run meaning the count variable works, and when I use the dot notation the code doesn't work?[
const users = {
Alan: {
online: false
},
...
1
vote
0
answers
424
views
How to remove double square brackets from each rows of dataframe and data should not convert into string or list in python
As you can see in image I want to remove all square brackets from Problem column
df["Problem"].astype(str).replace('[','',regex=True).astype(str).replace('\]','',regex=True)
Note: By using ...
4
votes
1
answer
1k
views
C++ square bracket overloading with and without const/ampersand
I am writing C++ code, and ran into a case where I wish to overload the square bracket operator for my class. From various sources, I find that you usually make two methods to do this, one with the ...
1
vote
1
answer
709
views
C++ operator overloading [] and return types
I'm just revisiting C++, and I have a question about overloading of the [] operator, and more specifically why my program doesn't work.
Given the following code in vec.cpp:
double Vec::operator[](...
2
votes
3
answers
108
views
PHP replace patterns in string with URLs
I have a few hundred html files that I want to show on a website.
They all have links in them in the following format:
[My Test URL|https://www.mywebsite.com/test?param=123]
The problem is that some ...
3
votes
1
answer
1k
views
Command with 'creates' is not idempotent when using filenames with square brackets
I have a task that creates multiple files, if they not exists. It works, until a filename is used as item that contains a pair of square brackets. I've tried to escape with backslashes and {% raw %} ...
-1
votes
1
answer
659
views
What is the [][] (double square brackets operator) operator in python?
I am new to python and I was looking for the correct way to do a ternary operation when assigning a variable.
I found a post on stack overflow of someone suggesting something like this:
var = ['...
0
votes
2
answers
180
views
Why isnt the indexing in this python script working?
I'm writing this script for an assignment so I'd appriciate being talked through it rather than simply being handed an answer. Basically I'm trying to convert feet to meters, meters to feet, and ...
0
votes
1
answer
317
views
Regex to parse multi-brace (and brackets) string
I am currently working on an import feature in a Java project and am receiving objects as a string. A structure similar to JSON is being used here. Objects are enclosed in curly braces and lists go in ...
-2
votes
1
answer
5k
views
Error reading JSON file containing square brackets in Python
I need to modify the values of a JSON file that is being used by another program. It looks like this:
[
{
"ENABLED": "True",
"NAME": "Cage",
"CODE&...
4
votes
1
answer
998
views
Is this a correct characterisation of the behaviours of square brackets in Scheme, Racket, Common Lisp, and Clojure?
I've recently done some digging. Due to my lack of Lisp experience, I want to verify what I've found. Is this a correct characterisation of the behaviours of square brackets in Scheme, Racket, Common ...
1
vote
2
answers
141
views
Why two single square brackets side by side in R
I am trying to learn data-cleaning with simple code.
My central question is: what is the use of two single square brackets side by side?
Here is df as an example.
df <- data.frame(x = c(1:3, NA, NA)...
0
votes
0
answers
21
views
How do I display square bracketed followed by round bracketed text in HTML without it being registered as a hyperlink?
I have an example that I am trying to write out in another forum, but I believe HTML formatting is registering my example as hyperlinks. Here is what I am trying to write out:
[who is](who_is_was) [...
-1
votes
3
answers
2k
views
How to print a value from a variable in square brackets? [duplicate]
last= "smith"
I am trying to print this line: John [Smith].
The answer is
last = "Smith"
msg = "John" + " ["+ last +"] "
print(msg)
But I don't ...
2
votes
2
answers
87
views
How do I look in a string with text inside quotations, but ignoring anything inside brackets using regex?
For example my string is:
var str = 'Hello "Counts1 [ignore1] Counts2 [ignore2] Counts3 [ignore3] Count these too"';
How would I get everything inside the string that is inside quotations ...
0
votes
2
answers
994
views
How pandas is handling square brackets [] and how to avoid that?
I have to read a tomcat access-log that has lines like:
[06/Nov/2020:00:43:04 +0200] /wsi/services/ServicesReadRequest 2265 10.101.101.101 200 21
trying to read the file as csv, setting all ...
0
votes
1
answer
601
views
Removing excess square brackets when dumping to JSON multiple times
For every time I dump a dictionary into a JSON file, a pair of square brackets is added, which I cannot figure out how to avoid.
I use "try" to write to an existing JSON file (where the ...
0
votes
1
answer
367
views
PhpStorm reformat square bracket on same line
I am working in a Symfony project, using PhpStorm and I have selected 'Symfony 2' as the preset to reformat code.
However the rest of the codebase has the following style:
$updatesTable->addRow([
...
0
votes
0
answers
46
views
Copy-Item doesn't work with square bracket in destination parameter [duplicate]
I am trying to copy a file from a folder to another using
Copy-Item $source -Destination $destination
but in $destination I have square brackets: Copy-Item doesn't throw an error but doesn't copy ...
-1
votes
1
answer
68
views
accessing length of an array inside an object gives me 'TypeError: Cannot read property 'length' of undefined'
I get an error TypeError: Cannot read property 'length' of undefined when trying to access length of an array inside of an object that I get from mapstatetoprops... In my actions folder, i created a ...
1
vote
1
answer
583
views
Remove elements in the square bracket of a string from Python
I am required to remove the elements within the square bracket of a string. However, I am unable to get the desired results.
Below is desired output I am required to get:
Example of the Output
[[apple]...
1
vote
3
answers
1k
views
How to overload operator[] for indexing the shared_ptr elements of a custom vector class?
Currently, I'm creating my own vector class, and I like to create instances of any class via shared pointers. So, is there a way to overload operator[] in order to achieve the following code?
class ...
0
votes
1
answer
937
views
How to print arrays with square brackets instead of curly brackets in Laravel? [duplicate]
I have this piece of code in my laravel controller and it prints an array as below: Iitems is a collection.
$i = [];
foreach($items as $item) {
$i['grid'][$item->color]['color'] = $item->...
-2
votes
1
answer
743
views
I'm just wondering if anyone could clarify why Square Brackets are being used during a Function call-back in JavaScript?
So, I'm currently working my way through JavaScript and often find myself getting the 'information overload' block regarding information...
I was hoping someone could clarify for me that why, if I ...
1
vote
2
answers
4k
views
Powershell script with a path with square brackets in a string for
I can't get my Powershell script to work with a path which has square brackets.
Input path is "c:\temp\yeah [thats it]"
param (
[string]$folderPath = $env:folderPath
)
$folderPath = $...
1
vote
0
answers
31
views
how to use grep to search for text strings from a file that contain square brackets?
I have 2 text files. I am trying to do the following:
Loop over all lines of file1
Find all lines in file2 where a given line fro file1 is a substring
So I want to do something like this:
for l in `...
0
votes
1
answer
1k
views
How to remove extraneous square brackets from a nested list inside a dictionary?
I have been working on a problem which involves sorting a large data set of shop orders, extracting shop and user information based on some parameters. Mostly this has involved creating dictionaries ...
0
votes
1
answer
111
views
How do I distinguish reads from writes when using the Proxy Pattern without breaking interaction with primitive types & member access for other types?
Preface
I'm asking this question after a week of investigating and reviewing dozens and dozens of proxy pattern implementations.
Please, do not incorrectly flag this question as a duplicate unless the ...
0
votes
1
answer
214
views
WP "retrieve_password_message"
do you happen to know how to remove those square brackets that come in the theme email template sent to users?
Thank you!
https://i.sstatic.net/g9VrO.jpg
1
vote
1
answer
2k
views
Finding differences in .JSON files using Powershell Compare-Object, problems with square bracket values
I am trying to compare two .json files using
# Compare two files
$BLF = (Get-Content -Path C:\Users\...\Documents\Android1.json)
$CLF = (Get-Content -Path C:\Users\...\Documents\Android2.json)
$...
1
vote
1
answer
8k
views
Javascript / React use of square brackets [duplicate]
I know there are a whole lot of questions on square brackets in javascript - however, I did not get an answer to my requirement
class SignIn extends Component{
constructor(props){
super(...